package com.lin.filegraph.utils.parser.node;

import org.eclipse.jdt.core.dom.ASTNode;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: linhuaixu
 * @time: 2023/5/18 10:22
 */

public class JMethodInvocationNode extends JTreeNode {

    private String strIvkMtdName; // 调用的方法名
    private boolean isSourceMethod = false;//
    private String strReturnType; // 返回类型
    private JMethodNode outerMethod = null;// 调用该方法的方法
    private String strOuterType;// 调用该方法的类
    private JMethodNode declaringMethod;// 被调用的方法
    private String strDeclaringType;// 被调用的方法所在的类
    private List<String> listActualParaTypes = new ArrayList<String>();// 实参

    public JMethodInvocationNode(String filePath, ASTNode astNode, String strIvkMtdName, String strReturnType,
                                 String strOuterType, JMethodNode outerMethod, JMethodNode declaringMethod, String strDeclaringType,
                                 List<String> listActualParaTypes) {
        super(filePath, astNode);
        this.strIvkMtdName = strIvkMtdName;
        this.strReturnType = strReturnType;
        this.outerMethod = outerMethod;
        this.strOuterType = strOuterType;
        this.declaringMethod = declaringMethod;
        this.strDeclaringType = strDeclaringType;
        this.listActualParaTypes = listActualParaTypes;
        if (declaringMethod != null) {
            this.isSourceMethod = true;
        }
    }

    public String getStrIvkMtdName() {
        return strIvkMtdName;
    }

    public List<String> getListActualParaTypes() {
        return listActualParaTypes;
    }

    public String getStrReturnType() {
        return strReturnType;
    }

    public JMethodNode getOuterMethod() {
        return outerMethod;
    }

    public String getStrOuterType() {
        return strOuterType;
    }

    public String getStrDeclaringType() {
        return strDeclaringType;
    }

    public JMethodNode getDeclaringMethod() {
        return declaringMethod;
    }

    @Override
    public String toString() {
        return "[MethodInvocationNode] strIvkMtdName:" + strIvkMtdName + " isSourceMethod?:" + isSourceMethod;
    }


}
